package com.codejam.gof.decrator;

import com.codejam.gof.decrator.concrete.LongBlack;
import com.codejam.gof.decrator.dec.Chocolate;
import com.codejam.gof.decrator.dec.Milk;

public class Test {

    /**
     * 试一下店里点饮料怎么算【使用装饰者模式】
     *
     * @param args
     */
    public static void main(String[] args) {

        //1. 先点一份基础款饮料
        LongBlack longBlack = new LongBlack();
        System.out.println(longBlack.getDesc());
        System.out.println(longBlack.cost());


        //2. 加入一份牛奶
        Milk milk = new Milk(longBlack);
        System.out.println(milk.getDesc());
        System.out.println(milk.cost());


        //3. 在上述基础上，再加入一份巧克力
        Chocolate chocolate = new Chocolate(milk);
        System.out.println(chocolate.getDesc());
        System.out.println(chocolate.cost());


        //4. 在上述基础上，再加入一份巧克力
        Chocolate chocolate2 = new Chocolate(chocolate);
        System.out.println(chocolate2.getDesc());
        System.out.println(chocolate2.cost());
    }
}
